<!DOCTYPE html>
<html>
<head>
<title>SMART - Dashboard</title>
<jsp:include page="../include/head.jsp" />
</head>
<body>
   <div class="wrapper">
      <!-- 导航区 -->
      <jsp:include page="../include/topnav.jsp" />
      <!-- 左侧菜单区 -->
      <jsp:include page="../include/menu.jsp" />
      <!-- 右侧边栏 -->
      <jsp:include page="../include/right.jsp" />
      <!-- Main section-->
      <section>
         <!-- Page content-->
         <div class="content-wrapper">
            <div class="content-heading">编辑贷款产品</div>
            <div class="panel panel-default">
            	<div class="panel-body">
            		<jsp:include page="../include/info.jsp" />
					<form role="form" action="admin/loan/edit" method="post" class="form-horizontal">
						<c:if test="${obj!=null}">
							<input type="hidden" name="id" value="${obj.id}" />
						</c:if>
						<div class="form-group">
							<label for="name" class="col-sm-2 control-label">平台名</label>
							<div class="col-sm-10">
								<input type="text" class="form-control" id="name" name="name" value="${obj.name}" />
								<span class="text-warning">贷款平台名，五个字左右最佳</span>
							</div>
						</div>
						<div class="form-group">
							<label for="iconUrl" class="col-sm-2 control-label">图标</label>
							<div class="col-sm-10">
								<div class="input-group">
									<input type="text" class="form-control" id="iconUrl" name="iconUrl" value="${obj.iconUrl}" />
									<span class="input-group-btn">
										<button class="btn btn-default" id="btnViewIcon" type="button">浏览</button>
									</span>
								</div>
								<span class="text-warning">正方形图片， 120x120 px</span>
							</div>
						</div>
						<div class="form-group">
							<label for="url" class="col-sm-2 control-label">链接地址</label>
							<div class="col-sm-10">
								<input type="text" class="form-control" id="url" name="url" value="${obj.url}" />
								<span class="text-warning">跳转到放贷方的URL, 注意前缀http://或https://要带上</span>
							</div>
						</div>
						<div class="form-group">
							<label for="shortDescription" class="col-sm-2 control-label">简介</label>
							<div class="col-sm-10">
								<input type="text" class="form-control" id="shortDescription" name="shortDescription" value="${obj.shortDescription}" />
								<span class="text-warning">10-15个字之间</span>
							</div>
						</div>
						<div class="form-group">
							<label for="targetGroup" class="col-sm-2 control-label">目标人群</label>
							<div class="col-sm-10">
								<input type="text" class="form-control" id="targetGroup" name="targetGroup" value="${obj.targetGroup}" />
								<span class="text-warning">3-10个字之间, 例如：上班族</span>
							</div>
						</div>
						<div class="form-group">
							<label for="totalApplyCount" class="col-sm-2 control-label">总申请笔数</label>
							<div class="col-sm-10">
								<input type="text" class="form-control" id="totalApplyCount" name="totalApplyCount" value="${obj.totalApplyCount}" />
								<span class="text-warning">数字, 例如：12000</span>
							</div>
						</div>
						<div class="form-group">
							<label for="successRate" class="col-sm-2 control-label">成功率</label>
							<div class="col-sm-10">
								<input type="text" class="form-control" id="successRate" name="successRate" value="${obj.successRate}" />
								<span class="text-warning">小数, 小数点后面不超过3位; 单位：百分比; 例如： 40.5</span>
							</div>
						</div>
						<div class="form-group">
							<label for="dailyInterestRate" class="col-sm-2 control-label">日利率</label>
							<div class="col-sm-10">
								<input type="text" class="form-control" id="dailyInterestRate" name="dailyInterestRate" value="${obj.dailyInterestRate}" />
								<span class="text-warning">小数, 小数点后面不超过3位, 单位：百分比; 例如：0.1</span>
							</div>
						</div>
						<div class="form-group">
							<label for="averageqQuota" class="col-sm-2 control-label">平均额度</label>
							<div class="col-sm-10">
								<input type="text" class="form-control" id="averageqQuota" name="averageqQuota" value="${obj.averageqQuota}" />
								<span class="text-warning">数字, 单位:元, 例如：30000</span>
							</div>
						</div>
						<div class="form-group">
							<label for="averageApplyTime" class="col-sm-2 control-label">平均申请耗时</label>
							<div class="col-sm-10">
								<input type="text" class="form-control" id="averageApplyTime" name="averageApplyTime" value="${obj.averageApplyTime}" />
								<span class="text-warning">例如：3小时</span>
							</div>
						</div>
						<div class="form-group">
							<label for="interestRate7" class="col-sm-2 control-label">7天利率</label>
							<div class="col-sm-2">
								<input type="text" class="form-control" id="interestRate7" name="interestRate7" value="${obj.interestRate7}" />
								<span class="text-warning">例如：小数, 小数点后面不超过3位, 单位：百分比; 例如：0.1</span>
							</div>
							<label for="interestRate15" class="col-sm-2 control-label">15天利率</label>
							<div class="col-sm-2">
								<input type="text" class="form-control" id="interestRate15" name="interestRate15" value="${obj.interestRate15}" />
								<span class="text-warning">例如：小数, 小数点后面不超过3位, 单位：百分比; 例如：0.1</span>
							</div>
							<label for="interestRate15" class="col-sm-2 control-label">30天利率</label>
							<div class="col-sm-2">
								<input type="text" class="form-control" id="interestRate30" name="interestRate30" value="${obj.interestRate30}" />
								<span class="text-warning">例如：小数, 小数点后面不超过3位, 单位：百分比; 例如：0.1</span>
							</div>
							<label for="interestRate90" class="col-sm-2 control-label">90天利率</label>
							<div class="col-sm-2">
								<input type="text" class="form-control" id="interestRate90" name="interestRate90" value="${obj.interestRate90}" />
								<span class="text-warning">例如：小数, 小数点后面不超过3位, 单位：百分比; 例如：0.1</span>
							</div>
							<label for="interestRate180" class="col-sm-2 control-label">180天利率</label>
							<div class="col-sm-2">
								<input type="text" class="form-control" id="interestRate180" name="interestRate180" value="${obj.interestRate180}" />
								<span class="text-warning">例如：小数, 小数点后面不超过3位, 单位：百分比; 例如：0.1</span>
							</div>
						</div>
						
						
						<div class="form-group">
							<label for="recommend" class="col-sm-2 control-label">是否新手推荐</label>
							<div class="col-sm-10">
								<label class="radio-inline"> 
									<input type="radio" name="recommend" id="recommendTrue" value="true" <c:if test="${obj.recommend}">checked</c:if> > 是
								</label> 
								<label class="radio-inline"> 
									<input type="radio" name="recommend" id="recommendFalse" value="false" <c:if test="${!obj.recommend}">checked</c:if>> 否
								</label>
							</div>
						</div>
						<div class="form-group">
							<label for="fast" class="col-sm-2 control-label">是否急速</label>
							<div class="col-sm-10">
								<label class="radio-inline"> 
									<input type="radio" name="fast" id="fastTrue" value="true" <c:if test="${obj.fast}">checked</c:if> > 是
								</label> 
								<label class="radio-inline"> 
									<input type="radio" name="fast" id="fastFalse" value="false" <c:if test="${!obj.fast}">checked</c:if>> 否
								</label>
							</div>
						</div>
						<div class="form-group">
							<label for="hot" class="col-sm-2 control-label">是否热门</label>
							<div class="col-sm-10">
								<label class="radio-inline"> 
									<input type="radio" name="hot" id="hotTrue" value="true" <c:if test="${obj.hot}">checked</c:if>> 是
								</label> 
								<label class="radio-inline"> 
									<input type="radio" name="hot" id="hotFalse" value="false" <c:if test="${!obj.hot}">checked</c:if>> 否
								</label>
							</div>
						</div>
						<div class="form-group">
							<label for="latest" class="col-sm-2 control-label">是否最新</label>
							<div class="col-sm-10">
								<label class="radio-inline"> 
									<input type="radio" name="latest" id="latestTrue" value="true" <c:if test="${obj.latest}">checked</c:if>> 是
								</label> 
								<label class="radio-inline"> 
									<input type="radio" name="latest" id="latestFalse" value="false" <c:if test="${!obj.latest}">checked</c:if>> 否
								</label>
							</div>
						</div>
						<input type="hidden" value="${obj.tags}" id="hiddenTags"/>
						<div class="form-group">
							<label for="tags" class="col-sm-2 control-label">分类</label>
							<div class="col-sm-10" id="selectType">
								<input type="checkbox" name="tags" value="急速下款" id="急速下款">急速下款
								<input type="checkbox" name="tags" value="审核快" id="审核快">审核快
								<input type="checkbox" name="tags" value="无手续费" id="无手续费">无手续费
								<input type="checkbox" name="tags" value="利率低" id="利率低">利率低
								<input type="checkbox" name="tags" value="通过率高" id="通过率高">通过率高
								<input type="checkbox" name="tags" value="白领专属" id="白领专属">白领专属
							</div>
						</div>
						
						<div class="form-group">
							<label for="sort" class="col-sm-2 control-label">排序</label>
							<div class="col-sm-10">
								<input type="text" class="form-control" id="sort" name="sort" value="${obj.sort}" />
								<span class="text-warning">数字，越小越排在前面</span>
							</div>
						</div>

						<div class="form-group" >
							<div class="col-sm-2"></div>
							<div class="col-sm-10">
								<button type="submit" class="btn btn-primary">提交</button>
								<a href="admin/loan/list" class="btn btn-primary">返回</a>	
							</div>
						</div>
					</form>
			 	</div>
			</div>
         </div>
      </section>
      <jsp:include page="../include/footer.jsp" />
   </div>
   <jsp:include page="../include/script.jsp" />
   <script src="ckfinder/ckfinder.js"></script>
   <script src="ckeditor/ckeditor.js"></script>
</body>
</html>
<script>
$('#mainMenu li').removeClass('active');
$('#menuLoan').addClass('active');

$('#btnViewIcon').click(function(){
	var finder = new CKFinder();
	finder.selectActionFunction = function(path){
		$('#iconUrl').val(path);
	};
	finder.popup();
})
var tags = $("#hiddenTags").val();//222,333
if(tags != null){
	var tagArr = tags.split(",");
	var els = $("input[name='tags']");
	
	for(var i=0; i<tagArr.length; i++){
		for(var j=0; j<els.length; j++){
			if($("#selectType input").eq(j).val()==tagArr[i]){
				$("#selectType input").eq(j).prop('checked',true);
			}
		} 
	}
}
</script>